load("//bazel:tachyon_cc.bzl", "tachyon_cc_library", "tachyon_cc_unittest")

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
    name = "fri_config",
    hdrs = ["fri_config.h"],
    deps = [
        "//tachyon/base:optional",
        "//tachyon/math/finite_fields:extension_field_traits_forward",
        "//tachyon/math/polynomials/univariate:evaluations_utils",
        "@eigen_archive//:eigen3",
    ],
)

tachyon_cc_library(
    name = "fri_proof",
    hdrs = ["fri_proof.h"],
    deps = [
        "//tachyon/base/buffer:copyable",
        "//tachyon/base/strings:string_util",
        "//tachyon/crypto/commitments:mixed_matrix_commitment_scheme_traits_forward",
        "@com_google_absl//absl/strings",
    ],
)

tachyon_cc_library(
    name = "lagrange_selectors",
    hdrs = ["lagrange_selectors.h"],
)

tachyon_cc_library(
    name = "prove",
    hdrs = ["prove.h"],
    deps = [
        ":fri_config",
        ":fri_proof",
        "//tachyon/base:bits",
        "//tachyon/crypto/challenger",
        "//tachyon/math/finite_fields:extension_field_traits_forward",
        "//tachyon/math/matrix:matrix_types",
    ],
)

tachyon_cc_library(
    name = "simple_fri",
    hdrs = ["simple_fri.h"],
    deps = [
        ":simple_fri_proof",
        ":simple_fri_storage",
        "//tachyon/base:logging",
        "//tachyon/base:optional",
        "//tachyon/base/containers:container_util",
        "//tachyon/crypto/commitments:univariate_polynomial_commitment_scheme",
        "//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree",
        "//tachyon/crypto/transcripts:transcript",
    ],
)

tachyon_cc_library(
    name = "simple_fri_proof",
    hdrs = ["simple_fri_proof.h"],
    deps = ["//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree:binary_merkle_proof"],
)

tachyon_cc_library(
    name = "simple_fri_storage",
    hdrs = ["simple_fri_storage.h"],
    deps = ["//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree:binary_merkle_tree_storage"],
)

tachyon_cc_library(
    name = "two_adic_fri",
    hdrs = ["two_adic_fri.h"],
    deps = [
        ":fri_proof",
        ":prove",
        ":two_adic_multiplicative_coset",
        ":verify",
        "//tachyon/base:bits",
        "//tachyon/base:parallelize",
        "//tachyon/base:profiler",
        "//tachyon/crypto/commitments:mixed_matrix_commitment_scheme_traits_forward",
        "//tachyon/math/finite_fields:extension_field_traits_forward",
        "//tachyon/math/geometry:dimensions",
        "//tachyon/math/matrix:matrix_types",
        "//tachyon/math/matrix:matrix_utils",
        "//tachyon/math/polynomials/univariate:evaluations_utils",
        "@com_google_absl//absl/container:btree",
        "@com_google_absl//absl/container:flat_hash_map",
    ],
)

tachyon_cc_library(
    name = "two_adic_multiplicative_coset",
    hdrs = ["two_adic_multiplicative_coset.h"],
    deps = [
        ":lagrange_selectors",
        "//tachyon/base:bits",
        "//tachyon/base:optional",
        "//tachyon/base/containers:container_util",
        "//tachyon/math/polynomials/univariate:radix2_evaluation_domain",
    ],
)

tachyon_cc_library(
    name = "verify",
    hdrs = ["verify.h"],
    deps = [
        ":fri_config",
        ":fri_proof",
        "//tachyon/base:bits",
        "//tachyon/base/ranges:algorithm",
        "//tachyon/math/geometry:dimensions",
    ],
)

tachyon_cc_unittest(
    name = "fri_unittests",
    srcs = [
        "fri_config_unittest.cc",
        "simple_fri_unittest.cc",
        "two_adic_fri_unittest.cc",
        "two_adic_multiplicative_coset_unittest.cc",
    ],
    deps = [
        ":fri_config",
        ":simple_fri",
        ":two_adic_fri",
        ":two_adic_multiplicative_coset",
        "//tachyon/crypto/challenger:duplex_challenger",
        "//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree",
        "//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree:binary_merkle_hasher",
        "//tachyon/crypto/commitments/merkle_tree/binary_merkle_tree:simple_binary_merkle_tree_storage",
        "//tachyon/crypto/commitments/merkle_tree/field_merkle_tree:extension_field_merkle_tree_mmcs",
        "//tachyon/crypto/commitments/merkle_tree/field_merkle_tree:field_merkle_tree_mmcs",
        "//tachyon/crypto/hashes/sponge:padding_free_sponge",
        "//tachyon/crypto/hashes/sponge:truncated_permutation",
        "//tachyon/crypto/hashes/sponge/poseidon2",
        "//tachyon/crypto/hashes/sponge/poseidon2:poseidon2_params",
        "//tachyon/crypto/hashes/sponge/poseidon2/param_traits:poseidon2_baby_bear",
        "//tachyon/crypto/transcripts:simple_transcript",
        "//tachyon/math/finite_fields/baby_bear:baby_bear4",
        "//tachyon/math/finite_fields/goldilocks",
        "//tachyon/math/finite_fields/test:finite_field_test",
        "//tachyon/math/matrix:matrix_types",
        "//tachyon/math/polynomials/univariate:univariate_evaluation_domain_factory",
    ],
)
